//
//  DSUnitListeningContent.m
//  DSJY
//
//  Created by 冯华强 on 16/10/19.
//  Copyright © 2016年 dsjy. All rights reserved.
//  单元练习的列表对象(json)

#import "DSUnitListeningContent.h"
#import "MTConst.h"
#import "NSString+Extension.h"

@implementation DSUnitListeningContent

- (NSString *)name
{
    if (_name != nil) {
        _name = [_name trim];
    }
    return [_name trim];
}

- (NSString *)src
{
    if (_src != nil) {
        _src = [_src trim];
    }
    return _src;
}

- (NSString *)nameString
{
    if (_nameString == nil && self.name) {
        _nameString = [[[[NSUserDefaults standardUserDefaults] objectForKey:DSExerciseDomainAddress] stringByAppendingString:self.name] specialFormat];
    }
    return _nameString;
}

- (NSString *)srcString
{
    if (_srcString == nil && self.src) {
        if ([self.src hasPrefix:@"/"]) { //是否以"/"开头
            self.src = [self.src substringFromIndex:1];
        }
        _srcString = [[[[NSUserDefaults standardUserDefaults] objectForKey:DSExerciseDomainAddress] stringByAppendingString:self.src] specialFormat];
    }
    return _srcString;
}

@end
